package com.cms.model.vo;

import com.cms.model.dto.PageDto;
import com.cms.utils.tools.DateUtil;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**系统用户实体*/
@Entity
@Table(name="sys_user")
public class SysUser extends PageDto implements Serializable {
    
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "user_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer  userId;
    
    /***/
    @Column(name = "user_login_name")
    private String  userLoginName;
    
    /***/
    @Column(name = "user_name")
    private String  userName;
    
    /***/
    @Column(name = "user_password")
    private String  userPassword;
    
    /***/
    @Column(name = "user_status")
    private Long  userStatus;
    
    /***/
    @Column(name = "creator")
    private String  creator;
    
    /***/
    @Column(name = "create_time")
    private Date  createTime;
    
    /***/
    @Column(name = "modifier")
    private String  modifier;
    
    /***/
    @Column(name = "update_time")
    private Date  updateTime;

    /**
     * 用户所对应的角色id
     */
    @Transient
    private String roleIds;
    /**
     * 用户所对应的角色名称
     */
    @Transient
    private String roleNames;
    /**
     * 查询项
     */
    @Transient
    private String searchTerm;
    /**
     * 查询内容
     */
    @Transient
    private String searchContent;

    public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public String getUserLoginName() {
		return userLoginName;
	}
	public void setUserLoginName(String userLoginName) {
		this.userLoginName = userLoginName;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserPassword() {
		return userPassword;
	}
	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}
	public Long getUserStatus() {
		return userStatus;
	}
	public void setUserStatus(Long userStatus) {
		this.userStatus = userStatus;
	}
	public String getCreator() {
		return creator;
	}
	public void setCreator(String creator) {
		this.creator = creator;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public String getModifier() {
		return modifier;
	}
	public void setModifier(String modifier) {
		this.modifier = modifier;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public String getRoleIds() {
		return roleIds;
	}
	public void setRoleIds(String roleIds) {
		this.roleIds = roleIds;
	}
	public String getRoleNames() {
		return roleNames;
	}
	public void setRoleNames(String roleNames) {
		this.roleNames = roleNames;
	}
	public String getSearchTerm() {
		return searchTerm;
	}
	public void setSearchTerm(String searchTerm) {
		this.searchTerm = searchTerm;
	}
	public String getSearchContent() {
		return searchContent;
	}
	public void setSearchContent(String searchContent) {
		this.searchContent = searchContent;
	}
	/**
     * 创建日期格式化
     * @return
     */
    public String getCreateTime_Lable(){
        if(this.getCreateTime() != null){
            return DateUtil.Date2Stirng2Second(createTime);
        }
        return "";
    }
    /**
     * 修改日期格式化
     * @return
     */
    public String getUpdateTime_Lable(){
        if(this.getUpdateTime() != null){
            return DateUtil.Date2Stirng2Second(updateTime);
        }
        return "";
    }
    public String getUserStatus_Lable(){
        if(this.getUserStatus() != null && this.getUserStatus().intValue() == 0){
            return "0-有效";
        }else if(this.getUserStatus() != null && this.getUserStatus().intValue() == 1){
            return "1-失效";
        }else{
            return "";
        }

    }
}